package com.come4loves.game.module.fight.helper;

import java.util.ArrayList;
import java.util.List;

import com.come4loves.game.module.fight.action.BatchAction;
import com.come4loves.game.module.fight.action.BuffAction;
import com.come4loves.game.module.fight.model.BuffData;
import com.come4loves.game.module.fight.model.FightCard;

public class BuffHelper {
	public static void trigger(FightCard fightCard, BatchAction batchAction) {
		if (fightCard.isDead()) {
			return;
		}
		List<BuffData> list = fightCard.getBuffers();
		if (list.isEmpty()) {
			return;
		}
		List<BuffData> timeOutBuff = new ArrayList<BuffData>();
		for (BuffData buffData : list) {
			buffData.heatBeat();
			if (buffData.isTimeOut()){
				timeOutBuff.add(buffData);
			}
		}
		for (BuffData buffData : timeOutBuff) {
			fightCard.removeBuff(buffData);
			BuffAction buffAction = new BuffAction(fightCard, buffData, 0);
			batchAction.addAction(buffAction);
		}
		
		
	}
}
